﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace QQ
{
    public partial class Denglu : Form
    {
        public Denglu()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            textBox1.Text = "QQ用户名";
            textBox2.Text = "QQ密码";
            User.getUser().AddUser("1","1","李相天");
        }

        private void button1_Click(object sender, EventArgs e)
        {
            string name = textBox1.Text;
            string pass = textBox1.Text;
            if (name.Equals(string.Empty) || pass.Equals(string.Empty))
            {
                MessageBox.Show("用户名或密码不能为空！");
                return;
            }
            if (User.getUser().panDuan(name, pass))
            {
                DengluHou fro = new DengluHou();
                foreach (var item in User.getUser().getYoghu())
                {
                    if (item.yong == textBox1.Text)
                    {
                        fro.name = item.name;
                        fro.user = item.yong;
                        fro.Show();
                        this.Hide();
                        return;
                    }
                }
            }
            MessageBox.Show("用户名或密码不对！");
        }
        int i = 0;
        private void textBox2_Click(object sender, EventArgs e)
        {
            if (i==0)
            {
                textBox2.PasswordChar = '*';
                textBox2.Text = string.Empty;
            }
            i++;
        }
    }
}
